package org.healer.simple_juc;

public class TestJoin implements Runnable{
    @Override
    public void run() {
        try {
            Thread.sleep(200); //不加这个会直接执行完，看不到效果
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 100; i++) {
            System.out.println("---------插队的来了--------"+i);
        }
    }
    public static void main(String[] args) throws InterruptedException {
        TestJoin tj=new TestJoin();
        Thread thread=new Thread(tj);
        thread.start();
        for (int i = 0; i < 500; i++) {
            if(i==200){
                thread.join();//强抢
                System.out.println("看不起我JOIN");
            }
            System.out.println("我是排队的"+i);

        }
    }
}
